<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style>
			.a1{
				font-size: 30px;
				color: palevioletred;
				text-decoration: none;
			}
		</style>
		<script>
			function changeAttr(){
				//获取超链接对象
				var af = document.getElementById("af");
				af.href="http://www.jd.com";
				af.innerHTML="京东";
				af.className = "a1";
			}
			
			function changeImg(){
				var img = document.getElementById("img1");
				img.src="../img/2.jpg";
				//调用对象的设置属性的方法
				img.setAttribute("width","300px");
				//调用对象的样式
			}
		</script>
	</head>
	<body>
		<a href="http://www.baidu.com" id="af">百度</a>
		<img src="../img/1.jpg"  id="img1"/>
		<button onclick="changeAttr()">改成京东</button>
		<button onclick="changeImg()">换图片</button>
	</body>
</html>
